package com.dx.service.impl;

import java.util.UUID;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dx.dao.AccountDao;
import com.dx.pojo.Account;
import com.dx.pojo.AccountCustom;
import com.dx.pojo.UserDetail;
import com.dx.service.AccountService;

@Service("accountService")
public class AccountServiceImpl implements AccountService {
    @Resource
    private AccountDao accountDao;
	
	@Override
	public int loginbypwd(Account account) {
		// TODO Auto-generated method stub
		return this.accountDao.loginbyidpwd(account);
	}

	@Override
	public int updatepwd(AccountCustom accountCustom) {
		// TODO Auto-generated method stub
		
		return this.accountDao.updatebyid(accountCustom);
	}
    
	//插入详细用户信息
	@Override
	public int insertuser(UserDetail userDetail) {
		// TODO Auto-generated method stub
		userDetail.setUserInfoId(UUID.randomUUID().toString().replaceAll("-", ""));
		return this.accountDao.insertuserdetail(userDetail);
	}

	//插入登录表
	@Override
	public int insertaccount(Account account) {
		// TODO Auto-generated method stub
		return this.accountDao.insertaccount(account);
	}

	//查询用户名称
	@Override
	public UserDetail selectusername(Account account) {
		// TODO Auto-generated method stub
		return this.accountDao.selectusername(account);
	}

	@Override
	public int updateuserdetail(UserDetail userDetail) {
		// TODO Auto-generated method stub
		return this.accountDao.updateuserdetail(userDetail);
	}

	@Override
	public String adminlogin(Account account) {
		// TODO Auto-generated method stub
		return this.accountDao.adminlogin(account);
	}

}
